package com.yunfeisoft.business.dao.impl;

import com.yunfeisoft.base.model.User;
import com.yunfeisoft.business.dao.inter.LaundryRoomDisinfectionSignDao;
import com.yunfeisoft.business.model.LaundryRoomDisinfectionSign;
import com.yunfeisoft.common.base.BaseDaoImpl;
import com.yunfeisoft.common.sql.builder.SelectBuilder;
import com.yunfeisoft.common.sql.builder.WhereBuilder;
import com.yunfeisoft.common.utils.Page;
import org.springframework.stereotype.Repository;

import java.util.Map;

/**
 * ClassName: LaundryRoomDisinfectionSignDaoImpl
 * Description: 洗衣房消毒签到表Dao实现
 * Author: Jackie liu
 * Date: 2020-05-22
 */
@Repository
public class LaundryRoomDisinfectionSignDaoImpl extends BaseDaoImpl<LaundryRoomDisinfectionSign, String> implements LaundryRoomDisinfectionSignDao {

    @Override
    public Page<LaundryRoomDisinfectionSign> queryPage(Map<String, Object> params) {
        WhereBuilder wb = new WhereBuilder();
        wb.setOrderByWithDesc("createTime");
        if (params != null) {
            initPageParam(wb, params);
        }
        SelectBuilder builder = getSelectBuilder("l");
        builder.column("u.name name")
                .join(User.class).alias("u")
                .on("u.id = l.createId").build();
        return queryPage(builder.getSql(), wb);
    }
}